package com.cloudcc.mobile.dao.impl;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.cloudcc.cloudframe.util.LogUtils;
import com.cloudcc.mobile.AppContext;
import com.cloudcc.mobile.dao.DingWeiDao;
import com.cloudcc.mobile.util.NetWork;
import com.cloudcc.mobile.util.UrlTools;
import com.litesuits.android.log.Log;

/**
 * 
 * 定期上传位置数据
 * 
 * @author wangzhiqiang
 * @date 2015-7-29 下午4:55:36
 * 
 */
public class DingWeiDaoImpl implements DingWeiDao {

	// 插入员工的位置数据
	public String insert(String data) {
		String url = "";
		String jsonString = "";
		try {
			String Data = URLEncoder.encode(data, "utf-8");// 这个是对json数据转编码，必须的
			Log.d("Stringdata", "Stringdata" + Data + "::" + data);
			url = UrlTools.url + UrlTools.url_path
					+ "serviceName=insert&objectApiName=ygdw&data=[" + Data
					+ "]&binding=" + AppContext.binding;
			jsonString = NetWork.get(url);
			Log.d("Stringdata", "Stringdata" + url);
			LogUtils.d("app", "上报位置数据：" + url + " 返回数据  " + url);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return jsonString;
	}

	@Override
	public String huoqu() {
		String url = "";
		String jsonString = "";
		// String Data = URLEncoder.encode(data, "utf-8");// 这个是对json数据转编码，必须的
		// Log.d("Stringdata", "Stringdata"+Data+"::"+data);
		url = UrlTools.url + UrlTools.url_path
				+ "serviceName=queryMobileSetup&binding=" + AppContext.binding;
		jsonString = NetWork.get(url);
		Log.d("Stringdata", "Stringdata" + url);
		LogUtils.d("app", "获取上报时间：" + url + " 返回数据  " + url);
		return jsonString;
	}

}
